package com.cqndt.visual.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.integration.annotation.ServiceActivator;
import org.springframework.integration.ip.udp.UnicastSendingMessageHandler;

/**
 * Created By marc
 * Date: 2021/5/12  11:11
 * Description:
 */
@Configuration
public class UdpIntegrationClientConfig {

    @Value("${udp.client.port}")
    private Integer udpPort;
    @Value("${udp.client.ip}")
    private String udpIp;

    @Bean
    @ServiceActivator(inputChannel = "udpOut")
    public UnicastSendingMessageHandler unicastSendingMessageHandler() {
        UnicastSendingMessageHandler unicastSendingMessageHandler = new UnicastSendingMessageHandler(udpIp, udpPort);
        return unicastSendingMessageHandler;
    }

}
